package me.zhengjie.poemPoet.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import me.zhengjie.poemmanager.domain.Comment;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;

/**
 * @description /
 * @author hwl
 * @date 2024-12-08
 ***/
@Data
@TableName("poem_poet")
public class PoemPoet implements Serializable {

    @TableId(value = "poem_id", type = IdType.AUTO)
    @ApiModelProperty(value = "主键")
    private Integer poemId;

    @NotBlank
    @ApiModelProperty(value = "标题")
    private String title;

    @ApiModelProperty(value = "副标题")
    private String subTitle;

    @ApiModelProperty(value = "作者id（用户的id或者作者的id）")
    private Integer authorId;

    @ApiModelProperty(value = "朝代")
    private String dynasty;

    @NotBlank
    @ApiModelProperty(value = "主体内容")
    private String content;

    @ApiModelProperty(value = "创造时间")
    private Timestamp createdAt;

    @ApiModelProperty(value = "更新时间")
    private Timestamp updatedAt;

    @ApiModelProperty(value = "作者姓名")
    private String authorName;

    @ApiModelProperty(value = "内容摘要")
    private String excerpt;

    @ApiModelProperty(value = "用户名称")
    private String userName;

    @ApiModelProperty(value = "点赞数")
    private Integer likeCount;
    

    @ApiModelProperty(value = "评论数")
    private List<Comment> comments;
    @ApiModelProperty(value = "评论数")
    private Integer commentCount;
    @ApiModelProperty(value = "收藏数")
    private Integer favoriteCount;


    public void copy(PoemPoet source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}